package com.xhw.controller;

import com.xhw.dto.ActionResult;
import com.xhw.po.SysCity;
import com.xhw.service.SysCityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * cities的名称选择
 */
@RestController
public class SysCityController {
    @Autowired
    private SysCityService sysCityService;

    /**
     * 地址的选择
     * @param pid int类型 pid
     * @return 返回ActionResult对象
     */
    @RequestMapping(value = "/getCities",method = RequestMethod.GET)
    public ActionResult findCitiesByPid(Integer pid) {
        List<SysCity> cities = sysCityService.findCitiesByPid(pid);
        System.out.println(cities);
        ActionResult result = new ActionResult(200, null, cities);
        return result;
    }
}
